package com.itheima.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author by itheima
 * @Date 2022/4/27
 * @Description spring的主配置类，作用：加载父容器相关的资源，包含service层的bean、dao层的bean、aop相关的bean等
 */
//@Configuration
//@ComponentScan("com.itheima.service")
//@ComponentScan({"com.itheima.service","com.itheima.componment"})
//顺带着把controller层资源一并加载了,所以需要排除
//使用excludeFilters属性指定排除bean资源的方式，type = FilterType.ANNOTATION表示以注解的方法排除，class指定具体排除哪些注解的bean资源
@ComponentScan(value = "com.itheima",
        excludeFilters ={@ComponentScan.Filter(
                type = FilterType.ANNOTATION,
                classes = {RestController.class, Controller.class,RestControllerAdvice.class})} )
//@EnableAspectJAutoProxy//开启AOP注解支持
@Import({JdbcConfig.class,MybatisConfig.class})
@EnableTransactionManagement//开启事务管理，底层对事务注解支持
public class SpringConfig {

}
